\section{R-Scripts}
\subsection{R-Script for the Latency Graph}
\begin{lstlisting}[label=lst:LatencyGraph, float=!t, language=R,
caption=R Script for the Latency Graph]
# Read files
R1_RT <- read.table("RobinRT25.csv", header=TRUE)
R1_No <- read.table("RobinNo25.csv", header=TRUE)
R2_RT <- read.table("ReneRT25.csv", header=TRUE)
R2_No <- read.table("ReneNo25.csv", header=TRUE)
# Factor of testsamples
# (Reduce the samplesize by this factor)
testsampleFactor <- 1
# Define max values
maxLatency <- max(c(R1_RT$Latency, R2_RT$Latency, R1_No$Latency, R2_No$Latency))
maxTime <- max(c(length(R1_RT$Latency), length(R1_No$Latency)))
# Save our graph
png("Latency.png")
# Start a plot with x- and y-axis labels and limitations
plot(0, 0, type="n", xlim=c(0,maxTime), ylim=c(0,maxLatency), xlab="Cycles", ylab="Latency", xaxt="n", yaxt="n")
# Draw y- and x-axis
yAxisMarks <- c(0, round(0.5*maxLatency), round(maxLatency))
xAxisMarks <- c(0, round(0.25*maxTime), round(0.5*maxTime), round(0.75*maxTime), maxTime)
axis(2, at=yAxisMarks)
axis(1, at=xAxisMarks)
# Colors
colors <- c("red1", "lig!tlue1", "red3", "lig!tlue3")
meanColors <- c("lig!tlue2", "red2", "lig!tlue4", "red4")
# Draw the 2 lines (functions)
lines(R2_No$Latency[c(1:(length(R2_No$Latency)/testsampleFactor)*testsampleFactor)], col=colors[4])
lines(R1_No$Latency[c(1:(length(R1_No$Latency)/testsampleFactor)*testsampleFactor)], col=colors[2])
lines(R1_RT$Latency[c(1:(length(R1_RT$Latency)/testsampleFactor)*testsampleFactor)], col=colors[1])
lines(R2_RT$Latency[c(1:(length(R2_RT$Latency)/testsampleFactor)*testsampleFactor)], col=colors[3])
# Draw lines for orientation
abline(h=yAxisMarks, col="gray", lwd=0.5)
# Draw the 2 means into
abline(h=mean(R1_No$Latency), col=meanColors[1], lwd=3, lty="dotted")
abline(h=mean(R1_RT$Latency), col=meanColors[2], lwd=3, lty="dotted")
abline(h=mean(R2_No$Latency), col=meanColors[3], lwd=3, lty="dotted")
abline(h=mean(R2_RT$Latency), col=meanColors[4], lwd=3, lty="dotted")
# Legend
legend("topleft",inset=.05, title="Hardware 1",c("Normal","Realtime"),fill=c(colors[2],colors[1]))
legend("top",inset=.05,title="Hardware 2",c("Normal","Realtime"),fill=c(colors[4],colors[3]))
legend("left",inset=.05,title="Means",c("H1 Normal","H1 Realtime", "H2 Normal","H2 Realtime"),fill=c(meanColors[1], meanColors[2], meanColors[3], meanColors[4]))
# Draw a box around the plot
box()
# Switch the device off to get a safe instance end
dev.off()
\end{lstlisting}

\subsection{R-Script for Boxplots}
\begin{lstlisting}[label=lst:RSciptboxplot, float=!t, language=R,
caption=R Script for Boxplots]
# Read data
data <- read.table("data.csv", header=TRUE)
# Y-Axis marks defining
yAxisMarks <- c(0, 2000, 4000, 6000, 8000, 10000)
# Define colors for the boxplots
colors <- c("red2", "red4","orange2","orange4","lig!tlue2", "lig!tlue4")
# Output file
png("boxplot.png")
# The names of the plots
theNames <- c(max(array(unlist(data[1]))), max(array(unlist(data[2]))), max(array(unlist(data[3]))), max(array(unlist(data[4]))), max(array(unlist(data[5]))), max(array(unlist(data[6]))))
# Generate the boxplots
boxplot(data, xlab="Maximum values of different kernels", ylab="Latency", col=colors, yaxt="n", names=theNames)
# Add the Y-Axis marks and horizontal lines to the diagram
abline(h=yAxisMarks, col="gray", lwd=0.5)
axis(2, at=yAxisMarks)
# Legend
legend("topleft",inset=.05, title="Latency in different kernels",c("(1) RT, no load", "(2) RT, 100% load", "(3) Test kernel, no load", "(4) Test kernel, 100% load", "(5) Normal, no load", "(6) Normal, 100% load"), fill=colors)
# Add a box for a nice view
box()
# Switch the device off to get a safe instance end
dev.off()
\end{lstlisting}

\subsection{R-Script for Task Distribution}
\begin{lstlisting}[label=lst:TaskDistribution, float=ht, language=R,
caption=R Script for the Task Distribution]
# load required libs
require(plotrix)
# Read files
Norm25 <- read.table("norm25.csv", header=TRUE)
Norm25P <- read.table("norm25p.csv", header=TRUE)
# Define data and boundaries
maxCycles <- 200000
yAxisMarks <- c(0, round(0.5*maxCycles), round(maxCycles))
colors <- c("lig!tlue","blue")
# Save our graph
png("histogram25.png")
#postscript("histogram25.ps")
# Histogram (25 Tasks)
data1<-hist(rbind(Norm25$Task),plot=FALSE,breaks=0:24)$counts
data2<-hist(rbind(Norm25P$Task),plot=FALSE,breaks=0:24)$counts
barp(rbind(data1, data2), col=colors) 
abline(h=yAxisMarks, col="gray", lwd=0.5)
# Print the legend
legend("topright",inset=.05, title="Cycles per Task", c("With Priority", "Without Priority"), fill=colors)
# Switch the device off to get a safe instance end
dev.off()
\end{lstlisting}